<%@ page pageEncoding="UTF-8"%>

<%@ taglib uri="/tags/struts-tiles" prefix="tiles"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<%@ taglib uri="/tags/struts-nested" prefix="nested"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>

<script type="text/javascript" src='resources/js/global/global.ca.js'></script>
<script type="text/javascript" src='resources/js/popup.js'></script>

<script>
		$(function(){
		$.each($(".view"),function(){
			$(this).click(function(){
				alert("123");
				var id=$(this).parent().parent().attr("class");
				alert(id);
				ShowIframe("123","http://localhost:8080/eduapp/admin/announce/paperview?id="+id,800,500);
			});	
		});
			
		$(".delete").click(function(){
				if(confirm("确定吗?")){   
				var id=$(this).parent().parent().attr("class");
				var t=$(this);
				alert(id);
				$.ajax({
					type: "POST",
					url: "admin/announce/delete",
					data: {"id":id},
					success: function(data){
								//t.parent().parent().parent().css("display","none");
								t.parent().parent().css("display","none");
								alert("删除成功");
								location.reload();
						   }
						 });
						 }
		});
		
		
		});
		/*
		$(".delete").click(function(){
			var id=$("#delete").parent().parent().attr("id");
			alert(id);
			$.ajax({
					type: "POST",
					url: "admin/announce/delete",
					data: {"id":id},
					success: function(data){
								$("#delete").parent().parent().fade();
								$.blockUI({ 
						            message:  "用户删除成功!", 
						            fadeIn: 700, 
						            fadeOut: 700, 
						            timeout: 2000, 
						            showOverlay: false, 
						            centerY: false, 
						            css: { 
						                width: '300px', 
						                top: '80px', 
						                left: ($(window).width()-300)/2 + 'px', 
						                padding: '10px 0px 0px 0px', 
						                height:'30px',
						                backgroundColor: '#fff',
						                '-webkit-border-radius': '10px', 
						                '-moz-border-radius': '10px', 
						                color: '#000' 
						            } 
						        });
						   }
						 });
		});
		
		
		
		<!--编辑文章-->
		$(".change").click(function(){
			var id=$("#passchange").parent().parent().attr("id");
			alert(id);
	        $("#passchange").parent().append(
			
										
			);
		});
		
		*/

		
			
		
</script>
<div id="panel-left" style="margin-bottom:10px;margin-top:10px">
	<div id="box-news">
			<table cellspacing="0" cellpadding="0" width="98%">
				<tr>
					<td colspan="3">
						<table cellspacing="0" cellpadding="0" width="100%">
							<tr>
								<td class="title_banner_left"></td>
								<td class="title_banner_center"><span class="banner_header">文章列表</span></td>
							  <td class="title_banner_right"></td>
							</tr>
						</table>
					</td>
				</tr>
                <tr>
                <td class="box_left"></td>
                <td>
                		<div class="box" style="margin-top:10px;">
				<table cellspacing="0" cellpadding="0" border="0" width="90%" align="center" height="100px">
                    <col width="6px" />
                    <col width="946px" />
                    <col width="6px" />
						<tr>
                            <td class="box_top_l"></td>
                            <td class="box_top_c box_title">查询条件</td>
                            <td class="box_top_r"></td>
						</tr>
                        <tr >
                        	<td class="box_left"></td>
                            <td>
                            	<div class="p" style="margin-top:10px;">
                                <form action="admin/announce/paperlist/1" method="post" id="frm_cxzz" >
	 <table width="80%" cellpadding="0" cellspacing="0" border="0" style="text-align:center;" class="datagrid" >
            <tr>
                <td><span>类型：  <select name="announceStatus" size=1 value="${announceStatus}">
                						<option value="0">请选择</option>
                                        <option value="1">新闻</option>
                                        <option value="2">动态</option>
                                   </select>
					</span>
				</td>
					<td><span>标题: <input type="text" size="12" name="announceSubject" class="text" value="${announceSubject}" id="announceSubject" /></span></td>
                    <td><input  width="50" type="submit" value="查询" class="sbtn" /></td>
            </tr>
     </table>
     </form>
     </div>
                            
                            </td>
                            <td class="box_right"></td>
                        </tr>
                        <tr>
                            <td class="box_btm_l"></td>
                            <td class="box_btm_c"></td>
                            <td class="box_btm_r"></td>
						</tr>
           		</table>
            </div>
                
                <div class="box" style="margin-top:10px;">
				<table cellspacing="0" cellpadding="0" border="0" width="90%" align="center" height="200">
                    <col width="6px" />
                    <col width="946px" />
                    <col width="6px" />
						<tr>
                            <td class="box_top_l"></td>
                            <td class="box_top_c box_title">查询结果</td>
                            <td class="box_top_r"></td>
						</tr>
                        <tr >
                        	<td class="box_left"></td>
                            <td>
                            		<div align="center" style="margin-top:10px;">          
                            <table width="95%" cellpadding="0" cellspacing="0" border="1" style="text-align:center;" class="datagrid">
                                <thead>
                                    <tr <c:if test="${idx % 2 == 1}">bgcolor="#fafbf5"</c:if>>
                                 		<td><input type="checkbox" id='ckall' /></td>
                                        <td>标题</td>
                                        <td>类型</td>
                                        <td>发布时间</td>
                                        <td>操作</td>
                                    </tr>
                                </thead>
                                    <logic:present name="result.page">
                                        <logic:iterate name="result.page" property="items" id="entity">
                                        	<logic:notEqual name="" value="1">
                                                    <tr class="${entity.id}">
                                                    	<td><input type="checkbox" id='ckall' /></td>
                                                        <td>${entity.announceSubject}</td>
                                                        <td>
                                                        	<c:if test="${entity.announceStatus==1}">
                                                            <c:out value="新闻"/>
                                                            </c:if>    
                                                            <c:if test="${entity.announceStatus==2}">
                                                            <c:out value="动态"/>
                                                            </c:if>                                         
                                                        </td>
                                                        <td>${entity.announceCreateTime}</td>
                                                        <td width='40%'>
                                                            <input type="button" id="view" value="编辑" class="sbtn view"  />
                                                        	<input type="button" value="删除" id="delete" class="sbtn delete"  />
                                                        </td>                                                     
                                                    </tr>
                                            </logic:notEqual>
                                        </logic:iterate>
                                    </logic:present>

                            </table>
                            <!-- Pagination Support-->
                                    <div class="tablenav-pages" align="right">
                                        <logic:notEmpty name="result.page">
                                            <span class="displaying-num">
                                                显示 
                                                <bean:write name="result.page" property="currentPageStartIndex" />
                                                –
                                                <bean:write name="result.page" property="currentPageEndIndex" /> 
                                                共 
                                                <bean:write name="result.page" property="totalCount" />
                                            </span>
                                            <bean:define id="currentPage" name="result.page" property="currentPage" />
                                            <logic:iterate id="pageIndex" name="result.page" property="pages">
                                                <c:choose>
                                                    <c:when test="${pageIndex eq currentPage}">
                                                        <span id="currentPage" class="page-numbers current"><c:out value="${pageIndex}" /></span>
                                                    </c:when>
                                                    <c:otherwise>
                                                        <a href="admin/announce/paperpage/<c:out value='${pageIndex}' />" class="page-numbers">
                                                            <c:out value="${pageIndex}" />
                                                        </a>
                                                    </c:otherwise>
                                                </c:choose>
                                            </logic:iterate>
                                        </logic:notEmpty>
                                    </div>                        
           			 </div>      
     </div>
                            
                            </td>
                            <td class="box_right"></td>
                        </tr>
                        <tr>
                            <td class="box_btm_l"></td>
                            <td class="box_btm_c"></td>
                            <td class="box_btm_r"></td>
						</tr>
           		</table>
            </div>
                
                
                
                
                </td>
                  <td class="box_right"></td>
                        </tr>
                        <tr>
                            <td class="box_btm_l"></td>
                            <td class="box_btm_c"></td>
                            <td class="box_btm_r"></td>
						</tr>
                 </table>
               
            </div>
</div>
